home *** CD-ROM | disk | FTP | other *** search
- property iOriginX, iOriginY, iButtonSize, iButtonArea, iButtonAreaRect, iOffsetLeft, iOffsetTop, iButtonRectList, iButtonOrigin, iPreviousSelectedKeyword, iCast, iSprite
- global theSparkle, theBlitPict, objIndexBtn, objBookmark, gallchapterlist, gIndexParagraphField, gGraphicPath, gFileName, gSpriteSetList, gNextPlay, gQuick, gKeywordDataList, gSelLine
-
- on birth me
- set iButtonSize to 12
- set tMaxH to 27
- set tMaxV to 23
- set iOriginX to 151
- set iOriginY to 114
- set iButtonArea to iOriginX & "," & iOriginY & "," & iOriginX + (iButtonSize * tMaxH) & "," & iOriginY + (iButtonSize * tMaxV)
- set iButtonAreaRect to BoxToRect(iButtonArea)
- set iOffsetLeft to iOriginX - iButtonSize
- set iOffsetTop to iOriginY - iButtonSize
- set iButtonOrigin to rect(iOffsetLeft, iOffsetTop, iOriginX, iOriginY)
- set pictfilepath to gGraphicPath & getProp(gFileName, #INDEXBTN)
- blitPictInitFile(objIndexBtn, pictfilepath)
- set iButtonRectList to [:]
- addProp(iButtonRectList, #NORMAL, "0,0,12,12")
- addProp(iButtonRectList, #VISITED, "324,0,336,12")
- addProp(iButtonRectList, #NORMAL_SELECTED, "336,0,348,12")
- addProp(iButtonRectList, #VISITED_SELECTED, "348,0,360,12")
- addProp(iButtonRectList, #MARKED, "360,0,372,12")
- addProp(iButtonRectList, #VISITED_MARKED, "372,0,384,12")
- addProp(iButtonRectList, #MARKED_SELECTED, "384,0,396,12")
- addProp(iButtonRectList, #VISITED_MARKED_SELECTED, "396,0,408,12")
- set iPreviousSelectedKeyword to gSelLine
- set iCast to the number of cast "index_paragraph_name_field"
- put EMPTY into field iCast
- set the text of cast iCast to "."
- set the textFont of cast iCast to returnFont(item 2 of gIndexParagraphField)
- set the textSize of cast iCast to integer(item 3 of gIndexParagraphField)
- set the textHeight of cast iCast to integer(item 4 of gIndexParagraphField)
- set the textStyle of cast iCast to item 5 of gIndexParagraphField
- set the textAlign of cast iCast to item 6 of gIndexParagraphField
- set trect to BoxToRect(item 7 to 10 of gIndexParagraphField)
- set the rect of cast iCast to trect
- set the foreColor of cast iCast to returnRGB(integer(item 11 of gIndexParagraphField))
- set iSprite to 38
- set the puppet of sprite iSprite to 1
- set the castNum of sprite iSprite to iCast
- set the rect of sprite iSprite to trect
- return me
- end
-
- on mStartIndex me
- repeat with tChapter = 1 to mGetMaxChapter(objBookmark)
- set tMaxParagraphs to mGetMaxParagraph(objBookmark, tChapter)
- mDrawNormalButtons(me, tChapter, tMaxParagraphs)
- repeat with tParagraph = 1 to tMaxParagraphs
- set tButtonStatus to mGetStatus(objBookmark, tChapter, tParagraph)
- if tButtonStatus <> #NORMAL then
- mDrawButton(me, tChapter, tParagraph, tButtonStatus)
- end if
- end repeat
- end repeat
- end
-
- on mDrawNormalButtons me, tChapterLine, tMaxParagraphs
- set tSrcRect to BoxToRect("0,0," & iButtonSize * tMaxParagraphs & "," & iButtonSize)
- set tDestRect to RectToBox(offset(tSrcRect, iOriginX, iOffsetTop + (tChapterLine * iButtonSize)))
- blitPictDrawScreen(objIndexBtn, RectToBox(tSrcRect), tDestRect, "copy", 0, 0)
- end
-
- on mDrawButton me, tChapter, tParagraph, tButtonStatus
- set tSrcRect to getaProp(iButtonRectList, tButtonStatus)
- set tDestRect to RectToBox(offset(iButtonOrigin, tParagraph * iButtonSize, tChapter * iButtonSize))
- blitPictDrawScreen(objIndexBtn, tSrcRect, tDestRect, "copy", 0, 0)
- end
-
- on mDrawKeywords me, tSelectedKeyword
- if iPreviousSelectedKeyword > 0 then
- repeat with keywordData in getAt(gKeywordDataList, iPreviousSelectedKeyword)
- set tChapter to getAt(keywordData, 1)
- set tParagraph to getAt(keywordData, 2)
- set tButtonStatus to mGetStatus(objBookmark, tChapter, tParagraph)
- mDrawButton(me, tChapter, tParagraph, tButtonStatus)
- end repeat
- end if
- set iPreviousSelectedKeyword to tSelectedKeyword
- repeat with keywordData in getAt(gKeywordDataList, tSelectedKeyword)
- set tChapter to getAt(keywordData, 1)
- set tParagraph to getAt(keywordData, 2)
- set tButtonStatus to value("#" & mGetStatus(objBookmark, tChapter, tParagraph) & "_SELECTED")
- mDrawButton(me, tChapter, tParagraph, tButtonStatus)
- end repeat
- end
-
- on mMouseUp me
- set tParagraph to (getAt(clickLoc(), 1) - iOffsetLeft) / iButtonSize
- set tChapter to (getAt(clickLoc(), 2) - iOffsetTop) / iButtonSize
- if (tChapter > 0) and (tParagraph > 0) and (tChapter <= mGetMaxChapter(objBookmark)) then
- if tParagraph <= mGetMaxParagraph(objBookmark, tChapter) then
- if the optionDown then
- mSetBookMark(objBookmark, tChapter, tParagraph)
- set tButtonStatus to mGetStatus(objBookmark, tChapter, tParagraph)
- if gSelLine > 0 then
- set tThisParagraph to [tChapter, tParagraph]
- repeat with keywordData in getAt(gKeywordDataList, gSelLine)
- if tThisParagraph = keywordData then
- set tButtonStatus to value("#" & tButtonStatus & "_SELECTED")
- end if
- end repeat
- end if
- mDrawButton(me, tChapter, tParagraph, tButtonStatus)
- else
- sparkle(theSparkle, clickLoc())
- repeat with tSprite in getAt(gSpriteSetList, 3)
- set the visible of sprite tSprite to 0
- end repeat
- if gQuick then
- set gNextPlay to [tChapter, tParagraph, #play]
- else
- set gNextPlay to [tChapter, tParagraph, #pause]
- end if
- set the mouseDownScript to "playerMouseDownScript"
- go("PlayMode")
- end if
- else
- beep()
- end if
- else
- beep()
- end if
- end
-
- on mRollOver me
- if inside(point(mouseH(), mouseV()), iButtonAreaRect) then
- set tParagraph to (mouseH() - iOffsetLeft) / iButtonSize
- set tChapter to (mouseV() - iOffsetTop) / iButtonSize
- if (tChapter > 0) and (tParagraph > 0) and (tChapter <= mGetMaxChapter(objBookmark)) then
- if tParagraph <= mGetMaxParagraph(objBookmark, tChapter) then
- set the text of cast iCast to getAt(getAt(getAt(gallchapterlist, tChapter), tParagraph), 1)
- else
- set the text of cast iCast to " "
- end if
- else
- set the text of cast iCast to " "
- end if
- else
- set the text of cast iCast to " "
- end if
- end
-